package com.lft.graph01.create_graph;

/**
 * 图——测试
 */
public class GraphDemo {
	public static void main(String[] args) {
		GraphAdjacencyMatrix graphMatrix = new GraphAdjacencyMatrix(6, String.class);
		graphMatrix.insertVertex("V1");
		graphMatrix.insertVertex("V2");
		graphMatrix.insertVertex("V3");
		graphMatrix.insertVertex("V4");
		graphMatrix.insertVertex("V5");
		graphMatrix.insertVertex("V6");
		
		graphMatrix.insertEdge(0, 2, 10);
		graphMatrix.insertEdge(0, 4, 30);
		graphMatrix.insertEdge(0, 5, 100);
		graphMatrix.insertEdge(1, 2, 5);
		graphMatrix.insertEdge(2, 3, 50);
		graphMatrix.insertEdge(3, 4, 20);
		graphMatrix.insertEdge(3, 5, 10);
		graphMatrix.insertEdge(4, 5, 60);
		
		System.out.println("===============================================");
		
		GraphAdjacencyList graphList = new GraphAdjacencyList(8);
		graphList.insertVertex("V1");
		graphList.insertVertex("V2");
		graphList.insertVertex("V3");
		graphList.insertVertex("V4");
		graphList.insertVertex("V5");
		graphList.insertVertex("V6");
		
		graphList.insertEdge(0, 2, 10);
		graphList.insertEdge(0, 4, 30);
		graphList.insertEdge(0, 5, 100);
		graphList.insertEdge(1, 2, 5);
		graphList.insertEdge(2, 3, 50);
		graphList.insertEdge(3, 4, 20);
		graphList.insertEdge(3, 5, 10);
		graphList.insertEdge(4, 5, 60);
	}
}

